package com.sanyang.pda.ui.manualoutbound;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.ogaclejapan.smarttablayout.SmartTabLayout;
import com.sanyang.pda.adapter.MyTitleViewPagerAdapter;
import com.sanyang.pda.utils.StringConfig;
import com.wangshen.base.app.AppActivityKey;
import com.wangshen.base.ui.mvp.base.ui.BaseActivity;
import com.wangshen.projectbase.R;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.OnClick;

@Route(path = AppActivityKey.MANUALOUTBOUNDDETAILACTIVITY)
public class ManualOutBoundDetailActivity extends BaseActivity {

    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.tv1)
    TextView tv1;
    @BindView(R.id.title)
    FrameLayout title;
    @BindView(R.id.smart)
    SmartTabLayout smart;
    @BindView(R.id.vp_content)
    ViewPager vpContent;
    private ArrayList<String> list_title;
    private ArrayList<Fragment> list_fragment;
    private MyTitleViewPagerAdapter mPagerAdapter;


    @SuppressLint("WrongViewCast")
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        String deliveryNo = getIntent().getStringExtra(StringConfig.DELIVERYNO);
        if (deliveryNo == null) {
            deliveryNo = "";
        }
        tv1.setText(deliveryNo);
        list_title = new ArrayList<>();
        list_fragment = new ArrayList<>();
        list_title.add(getString(R.string.set_of_supporting));
        list_title.add(getString(R.string.statistics));
        list_title.add(getString(R.string.detail));
        //初始化各fragment,并加入列表
        ManualOutWarehousingFragment manualOutWarehousingFragment = new ManualOutWarehousingFragment(deliveryNo);
        ManualOutBoundStatisticsFragment manualStatisticsFragment = new ManualOutBoundStatisticsFragment(deliveryNo);
        ManualOutBoundDetailFragment manualDetailFragment = new ManualOutBoundDetailFragment(deliveryNo);
        list_fragment.add(manualOutWarehousingFragment);
        list_fragment.add(manualStatisticsFragment);
        list_fragment.add(manualDetailFragment);
        mPagerAdapter = new MyTitleViewPagerAdapter(getSupportFragmentManager(),list_fragment,list_title);
        vpContent.setAdapter(mPagerAdapter);
        vpContent.setOffscreenPageLimit(3);
        smart.setViewPager(vpContent);
        //viewpager加载adapter
    }

    @Override
    public int getView() {
        return R.layout.activity_manual_outbound_detail;
    }

    @Override
    public void initView() {

    }

    @Override
    public void initLinsenterner() {

    }

    @Override
    public void getData() {

    }

    @OnClick(R.id.iv_back)
    public void onViewClicked() {
        finish();
    }
}
